package com.han.factory.after.simple_factory;

/**
 * @ClassName SimpleCoffeeFactory
 * @Description 简单咖啡工厂类，用来生产咖啡
 * @Author duoduo Han
 * @Date 2024/6/4 10:38
 */
public class SimpleCoffeeFactory {
    public static Coffee createCoffee(String type) {
        Coffee coffee = null;
        if ("american".equals(type)) {
            coffee = new AmericanCoffee();
        } else if ("latte".equals(type)) {
            coffee = new LatteCoffee();
        } else {
            throw new RuntimeException("对不起，您所点的咖啡没有");
        }
        return coffee;
    }
}
